package brainbots;

public class Simulator implements Runnable{
	
	private World world;
	private double step = 0.01;
    private boolean stopRequested  = false;
    private double timeElapsed = 0.0;
    
    public World getWorld()
    {
        return world;
    }
	public void setStep(double step){
		this.step = step;
	}
    public double getStep(){
        return step;
    }
    
	public void requestStop(){
		stopRequested = true;
	}
    
	
	@Override
	public void run() {
		
		while (!stopRequested){
            world.simulate(step);
            timeElapsed += step;
		}
	}
    public double getTimeElapsed(){
        return timeElapsed;
    }
    public void resetTimeElapsed(){
        timeElapsed = 0.0;
    }
	public Simulator(World w) {
		world = w;
	}
}
